//
//  WKMnemonicsBackupVM.m
//  WuKongUsernameLogin
//
//  Created by tt on 2023/9/10.
//

#import "WKMnemonicsBackupVM.h"
#import "WKMnemonicsListCell.h"
#import <WuKongUsernameLogin/WuKongUsernameLogin-Swift.h>
#import "WKAttentionTipCell.h"
#import "WKMnemonicsVeritfyVC.h"
@interface WKMnemonicsBackupVM ()

@end

@implementation WKMnemonicsBackupVM

- (NSArray<NSDictionary *> *)tableSectionMaps {
    NSString *mnemonics = [WKWeb3Helper generateMnemonics];
    NSArray *mnemonicsList = [mnemonics componentsSeparatedByString:@" "];
    return @[
        @{
            @"height":@(20.01f),
            @"items":@[
                    @{
                        @"class":WKLabelModel.class,
                        @"text":LLang(@"助记词用于恢复钱包及重置钱包密码，请准确无误抄写助记词，并存放在安全的地方"),
                        @"left": @(40),
                        @"width": @(WKScreenWidth - 80.0f),
                        @"center":@(true),
                        @"font":[WKApp.shared.config appFontOfSizeMedium:14.0f],
                        @"textColor": WKApp.shared.config.defaultTextColor,
                    },
            ],
        },
        @{
            @"height":@(20.01f),
            @"items":@[
                    @{
                        @"class":WKMnemonicsListModel.class,
                        @"items":mnemonicsList,
                    },
            ],
        },
        @{
            @"height":@(20.01f),
            @"items":@[
                    @{
                        @"class":WKAttentionTipModel.class,
                    },
            ],
        },
        @{
            @"height":@(50.0f),
            @"items":@[
                    @{
                        @"class":WKButtonItemModel2.class,
                        @"title": LLang(@"备份完成，进行验证"),
                        @"onPressed":^{
                            WKMnemonicsVeritfyVC *vc = [WKMnemonicsVeritfyVC new];
                            vc.mnemonics = mnemonicsList;
                            [WKNavigationManager.shared pushViewController:vc animated:YES];
                        }
                    },
            ],
        },
        @{
            @"height":@(20.0f),
            @"items":@[
                    @{
                        @"class":WKLabelModel.class,
                        @"text":LLang(@"复制助记词"),
                        @"center":@(true),
                        @"textColor": WKApp.shared.config.themeColor,
                        @"showArrow": @(false),
                        @"onClick":^{
                            UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
                            pasteboard.string = mnemonics;
                            UIView *topView = WKNavigationManager.shared.topViewController.view;
                            [topView showHUDWithHide:LLang(@"复制成功！")];
                        }
                    },
            ],
        },
    ];
}

@end
